package com.jgzx.constant.payment;

import cn.hutool.core.util.StrUtil;

/**
 * 付款类型
 * @author libo
 * @date 2021/5/6 17:03
 */
public enum PaymentTypeEnum {
    /** YFK【预付款】 */
    ADVANCE_PAYMENT("YFK", "预付款"),
    /** CGFK【采购付款】 */
    PURCHASE_PAYMENT("CGFK", "采购付款"),
    ;
    private final String value;
    private final String showName;

    /**
     * @param value 值
     * @param showName 显示名称
     */
    PaymentTypeEnum(String value, String showName){
        this.value = value;
        this.showName = showName;
    }

    /**
     * 通过付款类型值获取枚举对象
     * @param value 付款类型值
     * @return 付款类型枚举
     */
    public static PaymentTypeEnum getPaymentTypeByValue(String value){
        for(PaymentTypeEnum paymentType : PaymentTypeEnum.values()){
            if(StrUtil.equals(value, paymentType.value())){
                return paymentType;
            }
        }
        return null;
    }

    public String value() {
        return this.value;
    }

    public String showName() {
        return this.showName;
    }
}
